/* vim: ft=c ff=unix fenc=utf-8
 * file: cwmpd/src/modules/InternetGatewayDevice/User/User.c
 */

int cpe_get_user(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
{
	FUNCTION_TRACE();

	*value = pool_pstrdup(pool, "1");

	return	FAULT_CODE_OK;
}

int cpe_get_username(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
{
	FUNCTION_TRACE();
	char tmp[32] = {0};

	cfg_get_item("admin_user", tmp, sizeof(tmp)-1);

	*value = pool_pstrdup(pool, tmp);

	return	FAULT_CODE_OK;
}

int cpe_set_username(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
{
	FUNCTION_TRACE();
	
	cfg_set("admin_user", value);
	//cfg_save();

	return	FAULT_CODE_OK;
}

int cpe_get_password(cwmp_t * cwmp, const char * name, char ** value, pool_t * pool)
{
	FUNCTION_TRACE();
	char tmp[32] = {0};

	cfg_get_item("admin_Password", tmp, sizeof(tmp)-1);

	*value = pool_pstrdup(pool, tmp);

	return	FAULT_CODE_OK;
}

int cpe_set_password(cwmp_t * cwmp, const char * name, const char * value, int length, callback_register_func_t callback_reg)
{
	FUNCTION_TRACE();
	
	cfg_set("admin_Password", value);
	//cfg_save();

	return	FAULT_CODE_OK;
}


